#include "kraw.h"

#ifdef _WIN32

#include <windows.h>
#include <stdio.h>

using namespace Kraw;

const int MAX_BUFFER_LEN = 1024;

Time Timer::GetTime()
{
    return timeGetTime();//msec
}

//open log file
FILE* fpLog = 0;
void Log::Open( const char* file )
{
	fopen_s( &fpLog, file, "w" );
	if (fpLog)
	{
		fprintf( fpLog, "*** LOG STARTED ***\n" );
	}
}

void Log::Write( const char* msg )
{
	if (fpLog)
		fprintf( fpLog, msg );
	else
		OutputDebugString( msg );
}

void Log::Close()
{
	if (fpLog)
	{
		fclose( fpLog );
		fpLog = NULL;
	}
}

//filesystem
void File::SetCwd(const char *path)
{
    SetCurrentDirectory(path);
}

//memory
void* Memory::Alloc(int size)
{
    return malloc(size);
}

void Memory::Free(void* buf)
{
    free(buf);
}

#endif
